package br.gov.ana.pulsodagua.util;

import java.util.Comparator;

import br.gov.ana.pulsodagua.entidades.ChuvasEntity;

public class OrdenaChuvaEntity implements Comparator {
    
    public int compare(Object o1, Object o2) {
        ChuvasEntity ob1 = (ChuvasEntity)o1;
        ChuvasEntity ob2 = (ChuvasEntity)o2;
        if( ob1.getMaximaDia() == ob2.getMaximaDia() ) {
            return 0;    
        } else if( ob1.getMaximaDia() < ob2.getMaximaDia() ) {
            return 1;
        } else if( ob1.getMaximaDia() > ob2.getMaximaDia() ) {
            return -1;
        }
        return 0;
    }    
}
